﻿using System.Text;
using RAP.Framework.Libary.Utils;
using RAP.Framework.Libary.DomTemplateBuilder.Element.StringActions;
using RAP.Framework.Libary.DomTemplateBuilder.Interface;

namespace RAP.Framework.Libary.DomTemplateBuilder.Handler.StringActions
{
	/// <summary>
	/// 字符串压缩Handler
	/// </summary>
	public class CompressHandler : DynamicHandler
    {
		public new Compress Element
        {
            get
            {
				return base.Element as Compress;
            }
        }

        public override void DoRender ( StringBuilder writer, object rootParamObject, object parentParamObject, ITemplateRenderContext context )
        {
			var sb = new StringBuilder ( );
			base.DoRenderChildNodes ( sb, rootParamObject, parentParamObject, context );
			writer.Append ( sb.ToString ( ).CompressAsText ( ) );
        }
    }
}
